<style>
    * {
        margin: 0;
        padding: 0;
    }
    
    html,
    body {
        height: 100%;
        background-color: black;
    }
    
    .blood {
        width: 200px;
        height: 20px;
        border: solid #fff 1px;
        border-radius: 10px;
        overflow: hidden;
    }
    
    .blood span {
        /* width: 200px; */
        height: 20px;
        display: inline-block;
        background-color: red;
        border-radius: 10px;
    }
    
    p {
        color: #fff;
        font-size: 16px;
    }
</style>

<body>
    <div class="blood"><span style="width: 200px;"></span></div>
    <p title='+1'></p>
</body>
<script>
    var time = setInterval(function() {
        var spanObj = document.querySelector('.blood span');
        var width = parseInt(spanObj.style.width);
        width--;
        spanObj.style.width = width + 'px';
        if (width == 0) {
             clearIntval(time);
        }
    }, 100);

    function random(max, min) {
        return Math.floor(Math.random() * (max - min + 1) + min)
    };
    setInterval(function() {
        var imgObj = document.createElement('img');
        imgObj.src = './star.gif';
        imgObj.width = random(60, 40);
        imgObj.height = random(60, 40);
        imgObj.style.position = 'absolute';
        var maxLeft = (window.innerWidth || document.documentElement.clientWidth) - imgObj.width;
        var maxTop = (window.innerHeight || document.documentElement.clientHeight) - imgObj.height;
        imgObj.style.left = random(0, maxLeft) + 'px';
        imgObj.style.top = random(0, maxTop) + 'px';
        document.body.appendChild(imgObj);
    }, 1000);
    document.body.onclick = function(evt) {
        var e = evt || window.event;
        var target = e.target || e.srcElement;
        if (target.nodeName == 'IMG') {
            document.body.removeChild(target);
            var p = document.createElement("p")
            document.body.appendChild(p);
            p.innerHTML = "+1";

        }
    }
</script>